<template>

	<view class="resourceList">
		<uni-row style="margin-top: 20rpx;">
			<uni-col :span="18">
				<uni-datetime-picker v-model="range" type="daterange" />
			</uni-col>
			<uni-col :span="6" style="padding-left: 8rpx;padding-top: 7rpx;">
				<button type="default" size="mini" @click="queryClick">查询</button>
			</uni-col>
		</uni-row>

		<view v-for="(item,index) in payrollList" style="margin-top: 10rpx;">
			<uni-group mode="card">
				<uni-row class="resourceList-uni-row">
					<text class="resourceList-text">
						结算日期:&nbsp;&nbsp;&nbsp;{{item.payrollDate}}
					</text>
				</uni-row>
				<uni-row class="resourceList-uni-row">
					<text class="resourceList-text">
						人员:&nbsp;&nbsp;&nbsp;{{item.userName}} 
					</text>
				</uni-row>
				<uni-row class="resourceList-uni-row">
					<text class="resourceList-text">
						应发:&nbsp;&nbsp;&nbsp;{{item.shouldPay}}  &nbsp;&nbsp;&nbsp;元
					</text>
				</uni-row>
				<uni-row class="resourceList-uni-row">
					<text class="resourceList-text">
						实发:&nbsp;&nbsp;&nbsp;{{item.realPay}}  &nbsp;&nbsp;&nbsp;元
					</text>
				</uni-row>
				<uni-row class="resourceList-uni-row">
					<uni-col :span="4">
						<text class="resourceList-text">报工单:&nbsp;&nbsp;&nbsp;</text>
					</uni-col>
					<uni-col :span="20">
						<textarea  auto-height v-model="item.reportNumbers" style="margin-top: 5rpx;padding-right: 35rpx;" />
					</uni-col>
				</uni-row>
				<uni-row class="resourceList-uni-row">
					<uni-col :span="4">
						<text class="resourceList-text">备注:&nbsp;&nbsp;&nbsp;</text>
					</uni-col>
					<uni-col :span="20">
						<textarea  auto-height v-model="item.remark" style="margin-top: 5rpx;padding-right: 35rpx;" />
					</uni-col>
					
				</uni-row>
			</uni-group>
		</view>
	</view>

</template>

<script>
	import {
		getUserProfile
	} from "@/api/system/user"
	import {
		getDicts
	} from "@/api/system/dict/data";
	import {
		listInventory,
		getInventory
	} from "@/api/warehouse/inventory";
	import {
		listWarehouse
	} from "@/api/warehouse/warehouse";
	import {
		listPayroll
	} from "@/api/finance/payroll";
	
	export default {
		data() {
			return {
				queryParams: {pageSize: 99999,params:{},status:'A'},
				//库存列表
				payrollList: [],
				range:[],
				user: {},
			}
		},
		created() {
			 const nowDate = new Date();
			  // 设置为日期1号
			  nowDate.setDate(1);
			  this.range.push(new Date(nowDate).format("yyyy-MM-dd"))
			  // 获取当前月份(date.getMonth()返回的是0-11)
			  let month = parseInt(nowDate.getMonth() + 1);
			  // 获取当前月的最后一天。参数0代表上个月的最后一天
			  let endDate = new Date();
			  const endOfMonth = new Date(nowDate.getFullYear(), month, 0).getDate();
			endDate.setDate(endOfMonth)
			this.range.push(new Date(endDate).format("yyyy-MM-dd"))
			this.getList();
			
		},
		methods: {
			/** 查询列表 */
			getList() {
				getUserProfile().then(response => {
					this.user = response.data
					this.queryParams.params.beginPayrollDate=this.range[0];
					this.queryParams.params.endPayrollDate=this.range[1];
					this.queryParams.userId=this.user.userId;
					listPayroll(this.queryParams).then(reportResponse => {
						this.payrollList = reportResponse.rows
					})
				})
			},
			queryClick(){
				this.getList();
			},
				
		},
	}
</script>

<style>
	.resourceList-uni-row {
		margin-bottom: 8rpx;
	}

	.resourceList-text {
		font-size: 16px;
	}

	.resourceList {
		margin-left: 10px;

	}

	.uni-input {
		height: 50rpx;
		padding: 15rpx 25rpx;
		line-height: 50rpx;
		font-size: 28rpx;
		background: #FFF;
		flex: 1;
	}
</style>
